package com.capgemini.diabeo.activity;

import java.util.List;

import com.capgemini.diabeo.R;
import com.capgemini.diabeo.adapter.DishListAdapter;
import com.capgemini.diabeo.adapter.MenuListAdapter;
import com.capgemini.diabeo.manager.DishManager;
import com.capgemini.diabeo.model.Dish;
import com.capgemini.diabeo.model.Menu;
import com.capgemini.diabeo.view.MenuItemView;
import com.googlecode.androidannotations.annotations.AfterViews;
import com.googlecode.androidannotations.annotations.Bean;
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.ViewById;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;

@EActivity(R.layout.activity_historique)
public class HistoriqueDishActivity extends Activity{
	
	public static final String EXTRA_MENU = "extra.menu";
	
	@ViewById
	EditText search;

	@Bean
	DishListAdapter dishAdapter;

	@ViewById
	ListView menuList;

	@Bean
	DishManager dishManager;

	private Menu menu;
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		search.setVisibility(View.GONE);
		dishAdapter.removeAddButton();
	}
	
	@AfterViews
	public void afterViews() {
		menu = (Menu)getIntent().getSerializableExtra(HistoriqueMenuActivity_.EXTRA_MENU);

		List<Dish> dishs = dishManager.retrieveHistoryDish(menu);
		dishAdapter.setDishList(dishs);
		menuList.setAdapter(dishAdapter);
		
	}

}
